package com.kaifamiao.base.Demo210914;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lucien-ma
 * @date 2021/9/14
 * @apiNote
 */
public class Demo02 {

    public void demo() {
        Map<Short, Object> map = new HashMap<>();
        for (int i = 0; i < 100; i ++) {
            short s = (short)i;
            map.put(s, "" + s);
            map.remove(-- s);
        }

        System.out.println(map.size()); // 1
    }

    public void demo1() {
        Map<Short, String> map = new HashMap<>();
        for (short i = 0; i < 100; i ++){
            map.put(i, String.valueOf(i));
            map.remove(i - 1);
        }
        System.out.println(map.size()); // 100
    }

    public static void main(String[] args) {
        Short key1 = 1;
        Integer key2 = 1;
        System.out.println(key1.hashCode());
        System.out.println(key2.hashCode());

        Demo02 demo02 = new Demo02();
        //demo02.demo1();
        demo02.demo();
        System.out.println("end");
    }
}
